package com.lbx.springcloud.controller;

import com.lbx.springcloud.pojo.Dept;
import com.lbx.springcloud.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 吕兵星
 * @date 2020/11/8 15:57
 */
@RestController
public class ProviderController {

    @Autowired
    private DeptService deptService;

    @GetMapping("/provider/getById/{id}")
    public Dept getById(@PathVariable("id") Long id){
        return deptService.getById(id);
    }

    @GetMapping("/provider/getAll")
    public List<Dept> getAll(){
        return deptService.getAll();
    }

    @PostMapping("/provider/addDept")
    public Boolean addDept(Dept dept){
        return deptService.addDept(dept) > 0;
    }
}
